package b1.conifg
{
	import b1.conifg.story.*;
	import b1.players.*;

	public class VirtualAnimalConfig extends AnimalInfo
	{
		//战斗的信息
		public var fightConfig:FightConfig;
		//掉落装备及掉落概率(以装备的index为索引，掉落几率为值)
		public var armsDropPossibility:Object;
		//使用的魔法(以魔法的index为索引，等级为值)
		public var ownMagic:Object;
		
		public function VirtualAnimalConfig(virtualAnimalXML:XML = null)
		{
			super(virtualAnimalXML);
			//解析boss身上穿的装备信息
			for (var i:int = 0; i < virtualAnimalXML.armWearIndex.length(); i++)
			{
				var equip:EquipInfo = new EquipInfo();
				equip.objectIndex = parseInt(virtualAnimalXML.armWearIndex[i]);
				var position:int = (Config.objectConfigs[equip.objectIndex] as EquipConfig).position;
				this.equips[position] = equip;
			}
			fightConfig = new FightConfig(virtualAnimalXML.fightInfo[0]);
			//boss掉落的装备
			armsDropPossibility = new Object();
			for (i = 0; i < virtualAnimalXML.armDrop.length(); i++)
			{
				var armIndex:int =  parseInt(virtualAnimalXML.armDrop[i].armIndex);
				var armDropPossibility:Number = parseFloat(virtualAnimalXML.armDrop[i].armDropPossibility);
				armsDropPossibility[armIndex] = armDropPossibility;
			}
			//boss使用的魔法
			ownMagic = new Object();
			for (i = 0; i < virtualAnimalXML.ownMagic.length(); i++)
			{
				var magicIndex:int = parseInt(virtualAnimalXML.ownMagic[i].magicIndex);
				var magicLevel:int = parseInt(virtualAnimalXML.ownMagic[i].magicLevel);
				ownMagic[magicIndex] = magicLevel;
			}
		}
		
	}
}